package com.zcyr.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
public class DatabaseEnvironmentInfo implements Serializable {
    private String id;
    private Date create_time;
    private int expire_seconds = 1800;
    private Date active_time;
    private int reset_times;
    private String username;
    private String password;
    private String suffix;

    private void init(){
        this.create_time = new Date();
        this.active_time = this.create_time;
    }

    public DatabaseEnvironmentInfo(String id, String username, String password, int expire_seconds) {
        this.expire_seconds = expire_seconds;
        this.id = id;
        this.username = username;
        this.password = password;
        init();
    }

    public DatabaseEnvironmentInfo(){
        init();
    }

    public void increaseResetTimes(){
        ++this.reset_times;
    }
}
